From b2d94974603e025dfe4b4258ca70f3030956b044 Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Wed, 7 Jul 2004 13:07:37 +0000 Subject: [PATCH] bitkeeper revision 1.1041.15.2 (40ebf599xwzX2YRHxQvVAFkLp9CM5g) Fix disconnect handling in netif/blkif drivers. Add debug tracing to control-interface routines. --- .../xen/drivers/blkif/backend/interface.c | 4 ++- .../arch/xen/drivers/netif/backend/common.h | 2 +- .../xen/drivers/netif/backend/interface.c | 4 ++- .../arch/xen/kernel/ctrl_if.c | 31 +++++++++++++++++++ 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/interface.c b/linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/interface.c index 16b37164ab..a555b18e72 100644 --- a/linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/interface.c +++ b/linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/interface.c @@ -220,9 +220,11 @@ int blkif_disconnect(blkif_be_disconnect_t *disconnect, u8 rsp_id) free_irq(blkif->irq, blkif); blkif_deschedule(blkif); blkif_put(blkif); + return 0; /* Caller should not send response message. */ } - return 0; /* Caller should not send response message. */ + disconnect->status = BLKIF_BE_STATUS_OKAY; + return 1; } void __init blkif_interface_init(void) diff --git a/linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/common.h b/linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/common.h index f3eff0d81b..87fdb730d1 100644 --- a/linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/common.h +++ b/linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/common.h @@ -21,7 +21,7 @@ #define ASSERT(_p) \ if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s", #_p , \ __LINE__, __FILE__); *(int*)0=0; } -#define DPRINTK(_f, _a...) printk("(file=%s, line=%d) " _f, \ +#define DPRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \ __FILE__ , __LINE__ , ## _a ) #else #define ASSERT(_p) ((void)0) diff --git a/linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/interface.c b/linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/interface.c index ff3bc7bbf7..757d10ba2c 100644 --- a/linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/interface.c +++ b/linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/interface.c @@ -269,9 +269,11 @@ int netif_disconnect(netif_be_disconnect_t *disconnect, u8 rsp_id) free_irq(netif->irq, netif); netif_deschedule(netif); netif_put(netif); + return 0; /* Caller should not send response message. */ } - return 0; /* Caller should not send response message. */ + disconnect->status = NETIF_BE_STATUS_OKAY; + return 1; } void netif_interface_init(void) diff --git a/linux-2.4.26-xen-sparse/arch/xen/kernel/ctrl_if.c b/linux-2.4.26-xen-sparse/arch/xen/kernel/ctrl_if.c index 0e6389406c..f208efe100 100644 --- a/linux-2.4.26-xen-sparse/arch/xen/kernel/ctrl_if.c +++ b/linux-2.4.26-xen-sparse/arch/xen/kernel/ctrl_if.c @@ -17,6 +17,13 @@ #include #include +#if 0 +#define DPRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \ + __FILE__ , __LINE__ , ## _a ) +#else +#define DPRINTK(_f, _a...) ((void)0) +#endif + /* * Only used by initial domain which must create its own control-interface * event channel. This value is picked up by the user-space domain controller @@ -86,6 +93,11 @@ static void __ctrl_if_tx_tasklet(unsigned long data) { msg = &ctrl_if->tx_ring[MASK_CONTROL_IDX(ctrl_if_tx_resp_cons)]; + DPRINTK("Rx-Rsp %u/%u :: %d/%d\n", + ctrl_if_tx_resp_cons, + ctrl_if->tx_resp_prod, + msg->type, msg->subtype); + /* Execute the callback handler, if one was specified. */ if ( msg->id != 0xFF ) { @@ -131,8 +143,15 @@ static void __ctrl_if_rx_tasklet(unsigned long data) { pmsg = &ctrl_if->rx_ring[MASK_CONTROL_IDX(ctrl_if_rx_req_cons++)]; memcpy(&msg, pmsg, offsetof(ctrl_msg_t, msg)); + + DPRINTK("Rx-Req %u/%u :: %d/%d\n", + ctrl_if_rx_req_cons-1, + ctrl_if->rx_req_prod, + msg.type, msg.subtype); + if ( msg.length != 0 ) memcpy(msg.msg, pmsg->msg, msg.length); + if ( test_bit(msg.type, &ctrl_if_rxmsg_blocking_context) ) { pmsg = &ctrl_if_rxmsg_deferred[MASK_CONTROL_IDX( @@ -185,6 +204,11 @@ int ctrl_if_send_message_noblock( msg->id = i; } + DPRINTK("Tx-Req %u/%u :: %d/%d\n", + ctrl_if->tx_req_prod, + ctrl_if_tx_resp_cons, + msg->type, msg->subtype); + memcpy(&ctrl_if->tx_ring[MASK_CONTROL_IDX(ctrl_if->tx_req_prod)], msg, sizeof(*msg)); wmb(); /* Write the message before letting the controller peek at it. */ @@ -262,11 +286,18 @@ void ctrl_if_send_response(ctrl_msg_t *msg) * In this situation we may have src==dst, so no copying is required. */ spin_lock_irqsave(&ctrl_if_lock, flags); + + DPRINTK("Tx-Rsp %u :: %d/%d\n", + ctrl_if->rx_resp_prod, + msg->type, msg->subtype); + dmsg = &ctrl_if->rx_ring[MASK_CONTROL_IDX(ctrl_if->rx_resp_prod)]; if ( dmsg != msg ) memcpy(dmsg, msg, sizeof(*msg)); + wmb(); /* Write the message before letting the controller peek at it. */ ctrl_if->rx_resp_prod++; + spin_unlock_irqrestore(&ctrl_if_lock, flags); ctrl_if_notify_controller(); -- 2.30.2